
@php
    $start=date('Y-m-01 00:00:00',time());//获取指定月份的第一天
    $end=date('Y-m-t 00:00:00',time()); //获取指定月份的最后一天
    $days=\App\OrderPay::select(DB::raw("DAY(create_time) as day ,sum(total_money) as sum"))->whereBetween('create_time',[$start,$end])->where('pay_status',1)->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->groupBy('day')->pluck('sum','day')->toArray();

    $daysNum=date('t');
     $dayList=[];
     $price=0;
    for ($i=1;$i<=$daysNum;$i++){
        if(isset($days[$i])){
            $dayList['day'][]=$i;
            $dayList['num'][]=$days[$i];
            $price+=$days[$i];
        }else{
            $dayList['day'][]=$i;
            $dayList['num'][]=0;
        }
    }

@endphp
<div id="main" style="width: 600px;height:400px;"></div>


<script>
    $(function () {
        var myChart = echarts.init(document.getElementById('main'));
        var option = {
            title: {
                text: '本月日销售额(共计{{$price}}元)'

            },

            xAxis: {
                type: 'category',
                data: {{json_encode($dayList['day'])}},
                name: 'yue',
            },
            yAxis: {
                name:'销售额(元)',
                type: 'value'
            },
            series: [{
                data: {!! json_encode($dayList['num']) !!},
                type: 'line',
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    });

</script>z